/*
 * @Author: your name
 * @Date: 2022-04-02 15:48:55
 * @LastEditTime: 2022-04-15 13:55:37
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \dataonline-vite-ts\src\router\asyncRouters.ts
 */
import config from '@/config'
import deepClone from '@/libs/deepClone'
import {treeMap} from '@/libs/toolkit'
// import {customLayoutComp, layoutComp, moduleComp, phoneModuleComp} from '@/libs/defineComponent'
import {RouteRecordRaw} from 'vue-router'

function handleAsideConfig(): RouteRecordRaw[] {
  let aside_config = deepClone(config.router)

  // treeMap<CustomRoute>(aside_config, 'children', data => {
  //   let reg = /^phone-/
  //   let isPhone = reg.test(data.component)
  //   if (data.layout) {
  //     data.component = data.layoutCom ? customLayoutComp(data.layoutCom) : layoutComp()
  //   } else {
  //     let phoneCompPath = data.component.replace('phone-', '')
  //     data.component = isPhone ? phoneModuleComp(phoneCompPath) : moduleComp(data.component)
  //   }
  //   return false
  // })
  return aside_config
}

const asyncRouters = handleAsideConfig()

export default asyncRouters
